package org.xwalk.core.internal;


import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

public class XWalkFindListenerBridge extends XWalkFindListenerInternal {
    private XWalkCoreBridge coreBridge;
    private Object wrapper;

    public Object getWrapper() {
        return wrapper;
    }



    public XWalkFindListenerBridge(Object wrapper) {
        this.wrapper = wrapper;
        reflectionInit();
    }

    @Override
    public void onFindResultReceived(int activeMatchOrdinal, int numberOfMatches, boolean isDoneCounting) {
        onFindResultReceivedintintbooleanMethod.invoke(activeMatchOrdinal, numberOfMatches, isDoneCounting);
    }


    private ReflectMethod onFindResultReceivedintintbooleanMethod = new ReflectMethod(null, "onFindResultReceived");


    void reflectionInit() {
        coreBridge = XWalkCoreBridge.getInstance();
        if (coreBridge == null) return;

        onFindResultReceivedintintbooleanMethod.init(wrapper, null,
                "onFindResultReceived", int.class, int.class, boolean.class);
    }
}
